<template>
  <van-goods-action>
    <van-goods-action-icon
      :icon="isSave?'star':'star-o'"
      :text="isSave?'已收藏':'未收藏'"
      @click="isSave=!isSave"
      :color="isSave?'darkred':'#666'"
    />
    <van-goods-action-icon icon="cart-o" :badge="badgeNum" text="购物车" />
    <van-goods-action-button type="danger" @click="buyNow" text="立即购买" />
    <van-goods-action-button type="warning" @click="joinCart" text="加入购物车" />
  </van-goods-action>
</template>

<script>
export default {
  props: ['badgeNum'],
  data () {
    return {
      isSave: false
    }
  },
  methods: {
    // 立即购买
    buyNow () {
      this.$toast('该功能暂未开放')
    },
    // 加入购物车
    joinCart () {
      this.$emit('addToCart')
    }
  }
}
</script>

<style>
</style>
